package de.chessgame.gamelogic.piece;

import java.util.ArrayList;

import de.chessgame.gamelogic.Coordinate;

public class Bishop extends Piece {

	public Bishop(Fraction fraction) {
		super(Type.BISHOP, fraction);
	}

	@Override
	public void calculatePossibleMoves(Piece[][] content, int xOld, int yOld, boolean inCheck) {
		possibleMoves.clear();
		super.calculatePossibleMoves(content, xOld, yOld, inCheck);
		possibleMoves.addAll(givePossibleMovesForBishop(content, xOld, yOld));
	}

	@Override
	public boolean canMove(Piece[][] content, int xOld, int yOld, boolean inCheck) {
		return givePossibleMovesForBishop(content, xOld, yOld).size() != 0;
	}

	protected ArrayList<Coordinate> givePossibleMovesForBishop(
			Piece[][] content, int xOld, int yOld) {

		ArrayList<Coordinate> list = givePossibleMovesDiagonally(content, xOld,
				yOld);
		list = removeIrregularyMoves(content, list, xOld, yOld);
		return list;
	}
}
